package com.ocom.webapi.controller;


import com.ocom.common.constant.CompanyServiceUrl;
import com.ocom.common.request.company.ProductSuggestionPageRequest;
import com.ocom.common.request.company.ProductSuggestionRequest;
import com.ocom.common.resp.Result;
import com.ocom.common.utils.ResultUtil;
import com.ocom.webapi.feign.CompanyClientService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class ProductSuggestionController {

  @Autowired
  private CompanyClientService companyClientService;

  /**
   * 产品建议列表
   * @param request
   * @return
   */
  @PostMapping(CompanyServiceUrl.URL_productSuggestionPage)
  public Result productSuggestionList(@RequestBody ProductSuggestionPageRequest request) {
    Result entityProductSuggestionPage =companyClientService.productSuggestionPage(request);
    return ResultUtil.success(entityProductSuggestionPage.getData());
  }

  /**
   * 修改产品建议
   * @param request
   * @return
   */
  @PostMapping(CompanyServiceUrl.URL_productSuggestionUpdate)
  public Result productSuggestionUpdate(@RequestBody ProductSuggestionRequest request) {
    Result update =companyClientService.productSuggestionUpdate(request);
    return ResultUtil.success(update.getData());
  }

  /**
   * 删除产品建议
   * @param request
   * @return
   */
  @PostMapping(CompanyServiceUrl.URL_productSuggestionDelete)
  public Result productSuggestionDelete(@RequestBody ProductSuggestionRequest request) {
    Result delete =companyClientService.productSuggestiondelete(request);
    return ResultUtil.success(delete.getData());
  }

}
